import pandas as pd
import numpy as np
import time
import huber 
from forecast_models import *
from accuracy import RMSE,MAE,MAPE,R_square,sMAPE
df = pd.read_csv('data.csv',index_col = 0)
df.fillna(method='pad', inplace=True)


import warnings
warnings.filterwarnings('ignore')
horizon = 1
sequence_length = 8
index = 'Power'
epochs=32

model_index4 = 'LSTM'
y_test_rel,y_lstm_pre = lstm_model_huber(df,sequence_length = sequence_length,horizon = horizon,index =index, epochs = epochs)
mae_lstm = MAE(y_test_rel,y_lstm_pre)
rmse_lstm = RMSE(y_test_rel,y_lstm_pre)
mape_lstm = MAPE(y_test_rel,y_lstm_pre)
R_2=R_square(y_test_rel,y_lstm_pre)
print('lstm的MAE为：'+str(mae_lstm)) #"MAE:"
print('lstm的RMSE为：'+str(rmse_lstm)) #"RMSE:"
print('lstm的MAPE为：'+str(mape_lstm))
print('lstm的R2为：'+str(R_2))


model_index4 = 'LSTM'
y_test_rel,y_lstm_pre = lstm_model(df,sequence_length = sequence_length,horizon = horizon,index =index, epochs = 27)
mae_lstm = MAE(y_test_rel,y_lstm_pre)
rmse_lstm = RMSE(y_test_rel,y_lstm_pre)
mape_lstm = MAPE(y_test_rel,y_lstm_pre)
R_2_huber=R_square(y_test_rel,y_lstm_pre)
print('lstm的MAE为：'+str(mae_lstm)) #"MAE:"
print('lstm的RMSE为：'+str(rmse_lstm)) #"RMSE:"
print('lstm的MAPE为：'+str(mape_lstm))
print('lstm的R2为：'+str(R_2_huber))

